package com.example.demo2.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class IntercaptorConfig implements WebMvcConfigurer {

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(new BaseInterceptor()).addPathPatterns("/**").excludePathPatterns("/images/**");
		registry.addWebRequestInterceptor(new WebInterceptor())
				.addPathPatterns("/**");
	}

	// @Override
	// public void addResourceHandlers(ResourceHandlerRegistry registry) {
	// String basedir = new File(System.getProperty("user.dir")).getParent() +
	// "\\images\\";
	// registry.addResourceHandler("/images/**")
	// .addResourceLocations("file:" + basedir);

	// }

}
